# flask的简单网页程序，在网页的文本框输入一个数，点击提交按钮，在文本块下方返回该数的平方
from flask import Flask, render_template, request

app = Flask(__name__)

@app.route('/', methods=['GET', 'POST'])
def index():
    if request.method == 'POST':
        num = request.form['num']
        return render_template('index_app2.html', num=num, result=float(num)**2)
    else:
        return render_template('index_app2.html')

if __name__ == '__main__':
    app.run(debug=True)